import Vue from 'vue'
import Router from 'vue-router'
import error from '@/components/pages/error'
import home from '@/components/pages/home'
import login from '@/components/pages/login'
import articleContent from '@/components/pages/article-content'
import articleWrite from '@/components/pages/article-write'

Vue.use(Router);

export default new Router({
  routes: [
    {
      // 首页
      path: '/',
      name: 'home',
      component: home
    },
    {
      // 错误页
      path: '/error',
      name: 'error',
      component: error
    },
    {
      // 登陆页和注册页
      path: '/login',
      name: 'login',
      component: login
    },
    {
      // 文章内容
      path: '/:author/:category/:fileName',
      name: 'article-content',
      component: articleContent
    },
    {
      // 写文章页
      path: '/:author/write/:category',
      name: 'article-write',
      component: articleWrite
    }
  ]
})
